#! /bin/bash
clear
echo "正在执行执行配置脚本"
redis=127.0.0.1
read -p "请输入QQ小号（机器人）:" QQ
read -p "请输入QQ小号（机器人）:" key
read -p "请输入主人QQ（大号）" QQmaster
if [ ! -d /root/default_config/ ]; then
    cp -r  /root/Yunzai-Bot/config/default_config/ /root/
    sed -r -i "s/(host:).*/\1 $redis/" /root/default_config/redis.yaml
    sed -r -i "s/(qq:).*/\1 $QQ/" /root/default_config/qq.yaml
    sed -r -i "s/(pwd:).*/\1 '$key'/" /root/default_config/qq.yaml
    #qq
    sed -i "7i \ \-\ $QQmaster" /root/default_config/other.yaml
    sed -i "s#ffmpeg_path: #ffmpeg_path: /usr/local/bin/ffmpeg#g" /root/default_config/bot.yaml
    sed -i "s#ffprobe_path: #ffprobe_path: /usr/local/bin/ffprobe#g" /root/default_config/bot.yaml 
fi
if [ -d /root/default_config/ ]; then
    cp /root/default_config/* /root/Yunzai-Bot/config/config/
    rm -rf /root/default_config/
else
    echo "文件夹不存在"
fi


curl -sL https://gitee.com/Liplay-1/yun-zai-box/raw/master/device.json > /root/device.json

echo "#云崽工具箱"  >>/root/.bashrc
echo 'alias box="curl -sL https://gitee.com/Liplay-1/yun-zai-box/raw/master/box.sh |bash"' >>/root/.bashrc
bash

#安装完成
echo "安装完成,请输入:box 输入1 完成机器人登录操作"
